#include "head.hpp"
#include <time.h>
#include <stdlib.h>
#include <memory>
class Task{
public:
  Task(int a = 0, int b = 0):_a(a), _b(b){}

  int run()
  {
    int result = _a + (_a * _b);
    
    return result;
  }
private:
  int _a;
  int _b;
};
int main()
{
  srand((unsigned)time(NULL));
  std::unique_ptr<ThreadPool<Task> > tp(ThreadPool<Task>::getInstance());
  tp->start();

  while(true)
  {
    int a = rand() % 10;
    int b = rand() % 100;
    Task t(a,b);

    tp->push(t);
    sleep(1);
  }

  return 0;
}
